home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
wildcat
/
addbad10.zip
/
ADDBAD.BAS
next >
Wrap
BASIC Source File
|
1992-08-15
|
3KB
|
71 lines
'##########################################################################
'## ADDBAD.BAS ##
'## BASIC 7.1 source code by Tim Kilgore ##
'## Dated: 08/15/92 ##
'## ##
'## Updated: ##
'## By: ##
'## ##
'## Lines using QBX-specific commands are noted with a "QBX" comment to ##
'## facilitate conversions to QuickBASIC or QBasic. ##
'## ##
'##########################################################################
DEFINT A-Z
DECLARE SUB Reverse (ST$)
PRINT : PRINT : PRINT "AddBad v1.0, released into the Public Domain by Tim Kilgore"
work$ = COMMAND$ '%1 passed to SCANFILE.BAT
found = LEN(DIR$(work$)) 'Has the file been moved? (BAD) QBX
IF found = 0 OR LEN(work$) = 0 OR INSTR(work$, ".GIF") THEN
PRINT "Nothing to do. Done."
END
END IF
Reverse work$ 'Reverse the string and
IF INSTR(work$, "\") THEN 'find the file name.
work$ = LEFT$(work$, INSTR(work$, "\") - 1)
END IF
Reverse work$ 'Un-reverse the filename and
IF INSTR(work$, ".") THEN 'search for an extension.
work$ = LEFT$(work$, INSTR(work$, ".")) + "*" 'Change extension to "*"
END IF
TOP: 'For error handling
ON ERROR GOTO Trap 'Activate error handling
OPEN "BADFILES.LST" FOR APPEND LOCK WRITE AS #1 'Open BADFILES
ON ERROR GOTO 0 'De-activate error handling
PRINT #1, work$ 'Dump the file name to disk
CLOSE 'Close our files.
PRINT work$ + " added to " + CURDIR$; "\BADFILES.LST. Done!"; 'QBX
END 'Gone.
'##########################################################################
Trap: 'Error trapping...
ecount = ecount + 1 'Keep count of return trips
IF ecount = 6 THEN 'Tried to open for 5 seconds, gone
PRINT : PRINT "Unable to open BADFILES.LST. Terminating."
END
END IF
SLEEP 1 'Wait for file to become available
GOTO TOP 'Return and try to open file again
'##########################################################################
SUB Reverse (ST$)
'This SUB reverses any string sent to it. Handy at times...
FOR a = LEN(ST$) TO 1 STEP -1
tmp$ = tmp$ + MID$(ST$, a, 1)
NEXT a
ST$ = tmp$
END SUB